class Garlic extends GuaAnimation {
    static new(game) {
        let p = new this(game, animationGarlic)
        p.setup()
        return p
    }

    setup() {
        // row表示在草地的第几排
        this.row = -1
        this.cooldown = 5
        this.score = 50
        this.hp = 100
        this._sleep = true
    }

    remove() {
        this.scene.removeGarlic(this)
    }

    body1() {
        this.changeAnimation('body1')
    }

    body2() {
        this.changeAnimation('body2')
    }

    attack() {
        this.hp--
        if (this.hp > 50 && this.hp < 80) {
            this.body1()
        }
        if (this.hp < 50) {
            this.body2()
        }
        if (this.hp == 0) {
            this.remove()
        }
    }

    update() {
        super.update()
    }
}